<template>
  <Row :gutter="32">
    <Col span="8">
      <Button icon="md-add-circle" type="primary" v-auth:func:view:add
              @click="$emit('add-func')">新增功能</Button>
    </Col>
    <Col span="10">
      <Input search enter-button="查询" @on-search="searchText" v-auth:func:view:search
             placeholder="Enter something..." v-model="search.value">
        <template #prepend>
          <Select v-model="search.name" style="width: 80px">
            <Option value="funcName">功能名</Option>
            <Option value="menuName">菜单名</Option>
          </Select>
        </template>
      </Input>
    </Col>
  </Row>
</template>

<script>
export default {
  emits: ["add-func", "search"] ,
  data() {
    return {
      search: {
        name: 'funcName',
        value: '' ,
      }
    }
  },
  methods: {
    searchText(event) {
       // 将数组发送给父组件
       this.$emit('search', {[this.search.name]: this.search.value}) ;
    }
  }
}
</script>

<style scoped>

</style>